home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / ghostbbs.zip / MAILCLR.PAS < prev    next >
Pascal/Delphi Source File  |  1986-04-20  |  3KB  |  101 lines

  1. program mailclr;
  2.  
  3. type
  4.    messages = record
  5.              sender   :string[27];
  6.              recver   :string[25];
  7.              subject  :string[25];
  8.              date     :string[14];
  9.              messno   :integer;
  10.              pointer  :integer;
  11.         end;
  12.  
  13.   name      = string[14];
  14.   longname  = string[25];
  15.   filbuffer = array[0..127] of byte;
  16.   line      = string[80];
  17.   person    = string[27];
  18.   str10     = string[10];
  19.   long      = string[150];
  20.  
  21.  {$I id.rec }
  22.  
  23. var
  24.   infile, outfile : file of messages;
  25.   idfile : file of sysid;
  26.   goodmess,badmess,not_here,count,usernum : integer;
  27.   messrec : messages;
  28.   exists : boolean;
  29.   temprec : sysid;
  30.  
  31. procedure find_name(name:person; var num:integer; var gotit:boolean);
  32. {pass this procedure a username and it will tell you if it was found or not
  33.  and what his user number is }
  34. var
  35.   found   : byte;
  36. begin
  37.   found := 0;
  38.   num := -1;
  39.   assign(idfile,'IDS.BBS');
  40.   reset(idfile);
  41.   while(found = 0) do
  42.     begin
  43.       num := num + 1;
  44.       {$I-}
  45.       read(idfile,temprec);
  46.       {$I+}
  47.       if ioresult <> 0 then found := 2;
  48.       if temprec.user = name then found := 1;
  49.     end;
  50.   close(idfile);
  51.   gotit := (found = 1);
  52. end;
  53.  
  54. begin
  55.   goodmess := 0; badmess := 0; count := 0; not_here := 0;
  56.   assign(infile,'TITLE0.BBS'); assign(outfile,'Temp.tle');
  57.   reset(infile); rewrite(outfile);
  58.   while not eof(infile) do
  59.     begin
  60.       count := count + 1;
  61.       read(infile,messrec);
  62.       if messrec.recver = '***'
  63.         then begin
  64.            writeln('Message received #',count);
  65.            badmess := badmess + 1;
  66.         end
  67.         else begin
  68.           find_name(messrec.recver,usernum,exists);
  69.           case exists of
  70.             true : begin
  71.                      if temprec.pass = '***'
  72.                        then begin
  73.                          writeln(messrec.recver,' not found #',count);
  74.                          not_here := not_here + 1;
  75.                        end
  76.                        else begin
  77.                          writeln(messrec.recver,' #',count);
  78.                          goodmess := goodmess + 1;
  79.                          write(outfile,messrec);
  80.                        end;
  81.                    end;
  82.            false : begin
  83.                      writeln(messrec.recver,' not found #',count);
  84.                      not_here := not_here + 1;
  85.                    end;
  86.            end; { case }
  87.         end;
  88.     end;
  89.     close(infile);
  90.     close(outfile);
  91. writeln('Total processed = ',count);
  92. writeln('Total recieved  = ',badmess);
  93. writeln('Total not found = ',not_here);
  94. writeln('Total pending   = ',goodmess);
  95. end.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.